package com.chuanjiabao.wisdom.util.dialog;

import android.content.Context;
import android.databinding.DataBindingUtil;
import android.view.LayoutInflater;
import android.view.View;

import com.chuanjiabao.wisdom.R;
import com.chuanjiabao.wisdom.databinding.DialogAddCompleteBinding;
import com.chuanjiabao.wisdom.listener.OnBHClickListener;
import com.flyco.animation.SlideEnter.SlideTopEnter;
import com.flyco.dialog.widget.base.BaseDialog;

public class AddCompleteDialog extends BaseDialog {

    private Context mContext;
    private OnBHClickListener onBHClickListener;

    public AddCompleteDialog(Context context) {
        super(context);
        mContext = context;
    }

    @Override
    public View onCreateView() {
        widthScale(0.8f);
        DialogAddCompleteBinding binding = DataBindingUtil.inflate(
                LayoutInflater.from(mContext),
                R.layout.dialog_add_complete,
                null,
                false
        );
        binding.setDialog(this);
        return binding.getRoot();
    }

    @Override
    public void setUiBeforShow() {
        setCanceledOnTouchOutside(false);
        setCancelable(false);
        showAnim(new SlideTopEnter());
        dismissAnim(null);
    }

    public void setOnBHClickListener(OnBHClickListener onBHClickListener) {
        this.onBHClickListener = onBHClickListener;
    }

    public void noPoint(View view) {
        if (onBHClickListener != null) {
            onBHClickListener.onCloseClick();
        }
        dismiss();
    }

    public void okPoint(View view) {
        if (onBHClickListener != null) {
            onBHClickListener.onConfirmClick();
        }
        dismiss();
    }

}
